Microsoft Power Point objects |
The application has a collection of presentations (Power Point documents). And each presentation has a collection of slides. Each slide has shapes; and shapes has a collection of items. La aplicación principal tiene una colección de presentaciones (documentos de Power Point). Y cada presentación tiene una colección de transparencias. Cada transparencia tiene shapes; y shapes tiene una collección de items. |
Problem 1 |
Create a Wintempla dialog application called PowerPresentation to create a Microsoft Power Point document with one slide. Cree una aplicación de Wintempla de diálogo llamada PowerPresentation para crear un documento de Microsoft Power Point con una transparencia. |
PowerPresentation.h |
#pragma once //______________________________________ PowerPresentation.h #include "Resource.h" class PowerPresentation: public Win::Dialog { public: PowerPresentation() { ::CoInitialize(NULL); } ~PowerPresentation() { ::CoUninitialize(); } ... }; |
PowerPresentation.cpp |
... void PowerPresentation::Window_Open(Win::Event& e) { Com::Object Application; Com::Object Presentation; Com::Object Presentations; Com::Object Selection; Com::Object ActiveWindow; Com::Object ActivePresentation; Com::Object View; Com::Object Slides; Com::Object SlideRange; Com::Object Shapes; Com::Object ShapeRange; Com::Object Item; Com::Object TextFrame; Com::Object TextRange; Com::Object Characters; Com::Object TextRange2; _variant_t result; try { //_______________________________________________ Open Microsoft Power Point Application.CreateInstance(L"PowerPoint.Application", true); Application.Put(L"Visible", true); //_______________________________________________ Create a new Presentation Application.Get(L"Presentations", Presentations); Presentations.Method(L"Add", 2, Presentation); //_______________________________________________ Get: ActiveWindow and ActivePresentation Application.Get(L"ActiveWindow", ActiveWindow); Application.Get(L"ActivePresentation", ActivePresentation); //_______________________________________________ Add a new slide ActivePresentation.Get(L"Slides", Slides); Slides.Method(L"Add", 1, 1, result); //_______________________________________________ Get: Shapes ActiveWindow.Get(L"Selection", Selection); Selection.Get(L"SlideRange", SlideRange); SlideRange.Get(L"Shapes", Shapes); //_______________________________________________ Set slide title //Com::Container::DisplayInterfaceFunctions(hWnd, Shapes); Shapes.Method(L"Item", 1, Item); Item.Method(L"Select", 0, result); Selection.Get(L"ShapeRange", ShapeRange); ShapeRange.Get(L"TextRange", TextRange); TextRange.Method(L"Select", result); TextRange.Method(L"Characters", 1, 0, Characters); Characters.Method(L"Select", result); Selection.Get(L"TextRange", TextRange2); TextRange2.Put(L"Text", L"This is my first slide"); } catch(Com::Exception ex) { exep.Display(hWnd, L"PowerPresentation"); } } |